"""
    需求：登录接口的正向测试用例：登录成功(仅必填)
"""
# 导包
import requests

# 发送生成验证码接口请求，获取响应数据
resp_verify = requests.get(url="http://kdtx-test.itheima.net/api/captchaImage")
# 定义一个变量，用来接收提取uuid
uuid = resp_verify.json().get("uuid")
# 发送登录接口请求，将uuid引入请求数据
header_dict = {"Content-Type": "application/json"}
json_dict = {"username": "admin", "password": "HM_2023_test", "code": "2", "uuid": uuid}
url_str = "http://kdtx-test.itheima.net/api/login"
resp_login = requests.post(url=url_str, headers=header_dict, json=json_dict)
# 查看登录接口响应数据
print(resp_login.status_code)
print(resp_login.json())
